<template>
  <el-card shadow="never" class="aui-card--fill">
    <div class="mod-demo__xlsshoporders}">
      <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
        <el-form-item>
          <el-input v-model="dataForm.orderNo" placeholder="订单号" clearable></el-input>
        </el-form-item>
        <el-form-item>
          <el-button @click="getDataList()">{{ $t('query') }}</el-button>
        </el-form-item>
      </el-form>
      <el-table v-loading="dataListLoading" :data="dataList" border @selection-change="dataListSelectionChangeHandle" style="width: 100%;">
        <!-- <el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column> -->
        <!-- <el-table-column prop="id" label="订单" header-align="center" align="center"></el-table-column> -->
        <el-table-column prop="orderNo" label="订单号" header-align="center" align="center"></el-table-column>
        <el-table-column prop="username" label="买家姓名" header-align="center" align="center"></el-table-column>
		<el-table-column prop="mobile" label="买家手机号" header-align="center" align="center"></el-table-column>
        <el-table-column prop="orderStatus" label="订单状态" header-align="center" align="center">
			<template slot-scope="scope">
				<!--订单状态  -5订单过期失效-4平台拒绝 -3退款 -2未付款的订单 -1用户取消 0已付款 1已发货 2待发货 3系统确认收货 4平台审核中 5已完成-->
			  {{
				scope.row.orderStatus === -5 ? '订单过期失效' :
				scope.row.orderStatus === -4 ? '平台拒绝' :
				scope.row.orderStatus === -3 ? '退款' :
			    scope.row.orderStatus === -2 ? '未付款的订单' :
				scope.row.orderStatus === -1 ? '用户取消' :
				scope.row.orderStatus === 0 ? '已付款' :
				scope.row.orderStatus === 1 ? '已发货' :
				scope.row.orderStatus === 2 ? '待发货' :
				scope.row.orderStatus === 3 ? '系统确认收货' :
				scope.row.orderStatus === 4 ? '平台审核中' :
				scope.row.orderStatus === 5 ? '已完成' : ''
				 }}
			</template>
		</el-table-column>
        <!-- <el-table-column prop="isClosed" label="订单是否完结 1完结-1未完结" header-align="center" align="center"></el-table-column> -->
        <!-- <el-table-column prop="isPay" label="是否支付 -1未支付 1已支付" header-align="center" align="center"></el-table-column> -->
        <el-table-column prop="goodsMoney" label="商品总金额" header-align="center" align="center"></el-table-column>
        <el-table-column prop="totalMoney" label="订单总金额" header-align="center" align="center"></el-table-column>
        <!-- <el-table-column prop="payType" label="支付方式 1:线下现金支付 2 现金账户支付 3第三方支付4.支付宝.5微信6.银联" header-align="center" align="center"></el-table-column> -->
        <!-- <el-table-column prop="orderRemarks" label="订单备注" header-align="center" align="center"></el-table-column> -->
        <!-- <el-table-column prop="orderunique" label="订单流水号" header-align="center" align="center"></el-table-column> -->
        <el-table-column prop="paymentTime" label="付款时间" header-align="center" align="center"></el-table-column>
        <el-table-column prop="deliveryTime" label="发货时间" header-align="center" align="center"></el-table-column>
        <el-table-column prop="receiveTime" label="收货时间" header-align="center" align="center"></el-table-column>
        <el-table-column prop="expressNo" label="快递单号" header-align="center" align="center"></el-table-column>
        <!-- <el-table-column prop="expressId" label="快递公司Id" header-align="center" align="center"></el-table-column> -->
        <el-table-column label="收货地址" header-align="center" align="center">
			<template slot-scope="scope">
				{{scope.row.provinceName}}{{scope.row.cityName}}{{scope.row.areaName}}{{scope.row.userAddress}}
			</template>
		</el-table-column>
        <!-- <el-table-column prop="orderType" label="订单类型1.零售2.批发3.易物" header-align="center" align="center"></el-table-column> -->
        <el-table-column prop="createTime" label="下单时间" header-align="center" align="center"></el-table-column>
        <el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center" width="150">
          <template slot-scope="scope">
			  <div v-if="scope.row.orderStatus == 2">
				  <el-button  type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">详情</el-button>
				  <el-button type="text" size="small" @click="deliverHandle(scope.row.id)">发货</el-button>
			  </div>
            <div v-else>
				<el-button  type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">详情</el-button>
			</div>
          </template>
        </el-table-column>
      </el-table>
      <el-pagination
        :current-page="page"
        :page-sizes="[10, 20, 50, 100]"
        :page-size="limit"
        :total="total"
        layout="total, sizes, prev, pager, next, jumper"
        @size-change="pageSizeChangeHandle"
        @current-change="pageCurrentChangeHandle">
      </el-pagination>
      <!-- 弹窗, 新增 / 修改 -->
      <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
	  <deliver-goods v-if="deliverVisible" ref="delivergoods" @refreshDataList="getDataList"></deliver-goods>
    </div>
  </el-card>
</template>

<script>
import mixinViewModule from '@/mixins/view-module'
import AddOrUpdate from './xlsordersgoods-add-or-update'
import deliverGoods from './xlsdeliver-goods'
export default {
  mixins: [mixinViewModule],
  data () {
    return {
      mixinViewModuleOptions: {
        getDataListURL: '/demo/xlsshoporders/page',
        getDataListIsPage: true,
        exportURL: '/demo/xlsshoporders/export',
        deleteURL: '/demo/xlsshoporders',
        deleteIsBatch: true
      },
      dataForm: {
        id: ''
      }
    }
  },
  components: {
    AddOrUpdate,
	deliverGoods
  }
}
</script>
